package com.jizhi.onework.dataobj.param;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.jizhi.onework.dataobj.dto.UserDTO;
import com.jizhi.onework.framework.model.BaseParams;

import java.util.Date;

/**
 * 用户相关入口参数
 *
 * @author hzhang7
 */
public class UserParam extends BaseParams<UserDTO> {

    private Long id;

    private String password;

    private String phone;

    private String headImg;

    private String name;

    private String userName;

    private Long roleId;

    private String salt;

    private String email;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLoginTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return super.toString();
    }

    @Override
    public UserDTO toDTO() {
        UserDTO userDTO = new UserDTO();
        userDTO.setId(this.id);
        userDTO.setCreateTime(this.createTime);
        userDTO.setLastLoginTime(this.lastLoginTime);
        userDTO.setPassword(this.password);
        userDTO.setPhone(this.phone);
        userDTO.setUpdateTime(this.updateTime);
        userDTO.setHeadImg(this.headImg);
        userDTO.setName(this.name);
        userDTO.setUserName(this.userName);
        userDTO.setRoleId(this.roleId);
        userDTO.setSalt(salt);
        userDTO.setEmail(email);
        return userDTO;
    }
}